import { serviceCreate } from '../utils/request'
import { merge } from 'axios/lib/utils'
const http = serviceCreate({
  // baseURL: '/dv',
  // 表单提交
  emulateJSON: true
})
// @config {headers, emulateJSON, loading, msg, errMsg, disableInterceptor}
const methods = {
    // 获取话题基本信息
    getInfo (params, config) {
        params = merge({
            tag_name: ''
        }, params || {})
        return http.get('/topic/info', merge(config, { params }))
    },
    // 获取话题的活跃用户
    getActiveUsers (params, config) {
        params = merge({
            topic_id: ''
        }, params || {})
        return http.get('/topic/active_users', merge(config, { params }))
    },
    // 获取话题的相关动态
    getRelated (params, config) {
        params = merge({
            // 话题关键字
            topic_name: '',
            // 话题id
            topic_id: '',
            // 话题排序 2是按照时间
            sortby: 2,
            platform: 'h5',
            // 下一页的起始id
            offset: ''
        }, params || {})
        return http.get('/topic/about', merge(config, { params }))
    }
}

export default methods
